//package com.lanou3g.ptp.api.web.controller;
//
//import com.alibaba.dubbo.config.annotation.Reference;
//import com.lanou3g.ptp.entity.College;
//import com.lanou3g.ptp.entity.School;
//import com.lanou3g.ptp.organize.service.CollegeService;
//import com.lanou3g.ptp.organize.service.SchoolService;
//import com.lanou3g.ptp.utils.PtpResult;
//import com.lanou3g.ptp.utils.PtpResultUtils;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiOperation;
//import org.apache.ibatis.annotations.Param;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.HashMap;
//import java.util.Map;
//
//@Api(description = "学院接口")
//@RestController
//public class CollegeController {
//    @Reference
//    private CollegeService collegeService;
//    @Reference
//    private SchoolService schoolService;
//
//    @ApiOperation("通过id获取学院")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "学院id")
//    })
//    @GetMapping("/colleges/{id}")
//    public PtpResult findById(@PathVariable Long id) {
//        College college = collegeService.findById(id);
//        School school = schoolService.findById(college.getSchoolId());
//        Map<String, Object> result = new HashMap<>();
//        result.put("id", college.getId());
//        result.put("schoolName", school.getName());
//        result.put("name", college.getName());
//        result.put("leader", college.getLeaderId());
//        return PtpResultUtils.ok(result);
//    }
//
//    @ApiOperation("通过name查找学院")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "name", value = "学院名称")
//    })
//    @GetMapping("/college/{name}")
//    public PtpResult findByName(@PathVariable String name) {
//        College college = collegeService.findByName(name);
//        return PtpResultUtils.ok(college);
//    }
//
//    @ApiOperation("添加学院")
//    @PostMapping("/college")
//    public PtpResult addCollege(College college) {
//        collegeService.addCollege(college);
//        return PtpResultUtils.ok();
//    }
//
//    @ApiOperation("通过id批量删除学院")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "学院id")
//    })
//    @DeleteMapping("/college/{ids}")
//    public PtpResult deleteByIds(@PathVariable Long[] ids) {
//        collegeService.deleteByIds(ids);
//        return PtpResultUtils.ok();
//    }
//
//    @ApiOperation("通过id修改学院")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "学院id")
//    })
//    @PutMapping("/college")
//    public PtpResult updateById(@Param("id") Long id, @Param("college") College college) {
//        collegeService.updateById(college);
//        return PtpResultUtils.ok();
//    }
//
//
//}
